#ifndef INTERSECTIONS_H_
#define INTERSECTIONS_H_

#include <cmath>
#include "Point.h"
#include "RayIntersectionData.h"
#include "AABBIntersectionData.h"
#include "constants.h"
#include "Triangle.h"

using std::max;
using std::min;

namespace Intersections
{
bool AABBRay(float& near, float& far, const SPoint& AABBMin,
		const SPoint& AABBMax, const SPoint& rPos, const Vector& rDir);

/**
 * intersects an AABB with a given ray
 * returns a AABBIntersectionData-object, which stores the in and out of the ray
 * in and out are set to UNKNOWN if there is no intersection
 * @param AABBPos the center of the AABB
 * @param AABBSize the size of the AABB
 * @param RPos the position of the ray
 * @param RDir the direction of the ray
 */
//AABBIntersectionData AABBRay(const SPoint& AABBPos, const int AABBSize,
//		const SPoint& rPos, const Vector& rDir);

float rayTriangle(const SPoint& rayPos, const Vector& rayDir,
		const SPoint& triP1, const SPoint& triP2, const SPoint& triP3);

float rayTriangleFast(const SPoint& rayPos, const Vector& rayDir,
		TriAccel& acc);

bool rayTriangleFastSimple(const SPoint& rayPos, const Vector& rayDir,
		const TriAccel& acc);

}
;

#endif /*INTERSECTIONS_H_*/
